coord_cartesian(clip = "off") +
theme(
axis.line = element_blank(),
plot.margin = margin(12, 1.5, 0, 1.5)
) +
theme_bw()
print(pA2a)
pA2b <- ggplot(vdem_country %>% filter(measurement %in% c("v2cademmob_osp", "v2caautmob_osp")),
aes(year, value, group = measurement, color = measurement, linetype = measurement)) +
geom_line(size = .7) +
geom_point(size = 1) +
scale_y_continuous(
limits = c(round(min(vdem_country$value), 0), 4), expand = c(0, 0),
breaks = seq(round(min(vdem_country$value), 0),4,.5),
name = "Mass Mobilization (V-Dem)"
) +
scale_x_continuous(name = "", expand = c(0, 0),
limits = c(min(vdem_country$year), 2020),
breaks = seq(min(vdem_country$year),2020,5)) +
scale_color_manual("", breaks = c("v2cademmob_osp", "v2caautmob_osp"),
values = c("#08519C","#A50F15"),
labels = c("pro-democracy", "pro-autocracy")) +
scale_linetype_manual("", breaks = c("v2cademmob_osp", "v2caautmob_osp"),
values = c("solid", "dashed"),
labels = c("pro-democracy", "pro-autocracy")) +
coord_cartesian(clip = "off") +
theme(
axis.line = element_blank(),
plot.margin = margin(12, 1.5, 0, 1.5)
) + ggtitle("Tunisia") +
theme_bw()
print(pA2b)
cowplot::plot_grid(pA2b, pA2a, align = 'v', ncol = 1)
ggsave("output/Figure_A2.pdf",
width = 7,
height = 5,
dpi = "retina")
#select country VENEZUELA
vdem_country <- vdem_mmad  %>%
filter(country_name == "Venezuela") %>%
select(country_name, year, events_anti, events_pro, v2cademmob_osp, v2caautmob_osp) %>%
pivot_longer(cols = c(events_anti, events_pro, v2cademmob_osp, v2caautmob_osp),
names_to = "measurement") %>%
mutate(value_log = log(value + 1))
# Figure A3: Plot both time series
pA3a <- ggplot(vdem_country %>% filter(measurement %in% c("events_anti", "events_pro")),
aes(year, value, group = measurement, color = measurement, linetype = measurement)) +
geom_line(size = .7) +
geom_point(size = 1) +
scale_y_continuous(
limits = c(0, I(max(vdem_country$value) + 25)), expand = c(0, 0),
breaks = seq(0,I(max(vdem_country$value) + 25),25),
name = "Protest events (MMAD)"
) +
scale_x_continuous(name = "", expand = c(0, 0),
limits = c(min(vdem_country$year), 2020),
breaks = seq(min(vdem_country$year),2020,5)) +
scale_color_manual("", breaks = c("events_anti", "events_pro"),
values = c("#08519C","#A50F15"), labels = c("anti-government", "pro-government")) +
scale_linetype_manual("", breaks = c("events_anti", "events_pro"),
values = c("solid", "dashed"),
labels = c("anti-government", "pro-government")) +
coord_cartesian(clip = "off") +
theme(
axis.line = element_blank(),
plot.margin = margin(12, 1.5, 0, 1.5)
) +
theme_bw()
print(pA3a)
pA3b <- ggplot(vdem_country %>% filter(measurement %in% c("v2cademmob_osp", "v2caautmob_osp")),
aes(year, value, group = measurement, color = measurement, linetype = measurement)) +
geom_line(size = .7) +
geom_point(size = 1) +
scale_y_continuous(
limits = c(round(min(vdem_country$value), 0), 4), expand = c(0, 0),
breaks = seq(round(min(vdem_country$value), 0),4,.5),
name = "Mass Mobilization (V-Dem)"
) +
scale_x_continuous(name = "", expand = c(0, 0),
limits = c(min(vdem_country$year), 2020),
breaks = seq(min(vdem_country$year),2020,5)) +
scale_color_manual("", breaks = c("v2cademmob_osp", "v2caautmob_osp"),
values = c("#08519C","#A50F15"),
labels = c("pro-democracy", "pro-autocracy")) +
scale_linetype_manual("", breaks = c("v2cademmob_osp", "v2caautmob_osp"),
values = c("solid", "dashed"),
labels = c("pro-democracy", "pro-autocracy")) +
coord_cartesian(clip = "off") +
theme(
axis.line = element_blank(),
plot.margin = margin(12, 1.5, 0, 1.5)
) + ggtitle("Venezuela") +
theme_bw()
print(pA3b)
cowplot::plot_grid(pA3b, pA3a, align = 'v', ncol = 1)
ggsave("output/Figure_A3.pdf",
width = 7,
height = 5,
dpi = "retina")
#-------------Comparison with NAVCO 2.1 (Figure A4)-----------------------------
# merge V-Dem and Navco
vdem_navco <- left_join(vdem_sub, navco_sub, by = c("country_id", "year"))
#subset to coverage of NAVCO in order to have a comparable sample
vdem_navco_sub <- vdem_navco %>%
filter(year %in% seq(1945,2013,1)) %>%
mutate(some_events = ifelse(v2cademmob_ord > 0, 1, 0),
campaign = ifelse(is.na(campaign), 0, campaign),
overlap = ifelse(some_events == 1 & campaign == 1, 1, 0))
# Cross tab
navco_tab <- xtabs(~ some_events + campaign, data = vdem_navco_sub)
# Relabel dimensions
names(dimnames(navco_tab)) <- c("Mobilization for Democracy", "NAVCO 2.1")
names(rownames(navco_tab)) <- c("V-Dem", "NAVCO 2.1")
rownames(navco_tab) <- c("No events", "Several or more events")
colnames(navco_tab) <- c("No campaign", "Campaign year")
# Mosaic plot
pdf(file = "output/Figure_A4.pdf", height = 7, width = 9)
mosaic(navco_tab,
gp =  shading_hcl,
labeling = labeling_values)
dev.off()
#-------------Coder level / uncertainty analysis (Figure A5)--------------------------------------------
data <- vdem_sub %>%
mutate(time_since_1900 = (year - 1900) / 10)
# check predictors of disagreement
demmob_sd <- lme4::lmer(v2cademmob_sd ~ I(v2x_polyarchy*10) + I(v2mecenefm*-1) + v2cacamps +
log(e_pop) +  v2cademmob_nr + time_since_1900 +
(1|country_name),
data = data)
# check predictors of disagreement
autmob_sd <- lme4::lmer(v2caautmob_sd ~ I(v2x_polyarchy*10) + I(v2mecenefm*-1) + v2cacamps +
log(e_pop) + v2caautmob_nr + time_since_1900 +
(1|country_name),
data = data)
cm <- c('time_since_1900' = 'Time since 1900',
'v2cacamps' = 'Polarization',
'v2cademmob_nr' = 'Number of coders',
'v2caautmob_nr' = 'Number of coders',
'log(e_pop)' = 'Population size (log)',
'I(v2mecenefm * -1)' = 'Media censorship',
'I(v2x_polyarchy * 10)' = 'Electoral Democracy Index')
models <- list(
"Mobilization for autocracy" = autmob_sd,
"Mobilization for democracy" = demmob_sd
)
dat <- modelplot(models, coef_omit = 'Interc', coef_map = cm,
draw = F)
ggplot(dat, aes( y = term, x = estimate,
xmin = conf.low, xmax = conf.high,
color = model, shape = model)) +
geom_point(size = 2) +
geom_linerange(size = 1) +
scale_color_manual("", breaks = c("Mobilization for democracy",
"Mobilization for autocracy" ),
values = c("#08519C", "#A50F15")) +
scale_shape_manual("", breaks = c("Mobilization for democracy",
"Mobilization for autocracy" ),
values = c(17,19)) +
geom_vline(xintercept = 0, lty = "dashed") +
theme_bw() +
ylab("") +
xlab("Estimate") +
theme(panel.grid.major.y = element_blank())
ggsave(filename = "output/figure_A5.pdf",
width = 7, height = 5, dpi = "retina")
#-------------Maps of Mobilization in 2021 (Figures A6 and A7)------------------
vdem_sub_2021 <- vdem_sub %>%
filter(year == 2021)
map <- joinCountryData2Map(vdem_sub_2021,
joinCode = "ISO3",
nameJoinColumn = "country_text_id",
verbose = T)
#Exclude Antarctica
new_world <- subset(map, continent != "Antarctica")
#Define color palette
colors <- RColorBrewer::brewer.pal(n = 8, name = "Blues")
png(file="output/Figure_A6.png", width = 465, height = 295, units='mm', res = 300)
par(mar=c(1,1,1,0)) #(bottom, left, top, right)
mapParams <- mapCountryData(new_world, nameColumnToPlot = "v2cademmob_ord",
mapTitle = "",
colourPalette = colors,
catMethod = "pretty",
addLegend = F,
missingCountryCol = "#dddddd")
do.call(addMapLegend, c(mapParams, legendWidth=0.5, legendMar = 4, legendLabels = "all"))
dev.off()
#Define color palette
colors <- RColorBrewer::brewer.pal(n = 8, name = "Reds")
png(file="output/Figure_A7.png", width = 465, height = 295, units='mm', res = 300)
par(mar=c(1,1,1,0)) #(bottom, left, top, right)
mapParams <- mapCountryData(new_world, nameColumnToPlot = "v2caautmob_ord",
mapTitle = "",
colourPalette = colors,
catMethod = "pretty",
addLegend = F,
missingCountryCol = "#dddddd")
do.call(addMapLegend, c(mapParams, legendWidth=0.5, legendMar = 4, legendLabels = "all"))
dev.off()
#-------------Plot all country trajectories (Appendix C)-------------------------------------------
data_long <- vdem_sub %>%
dplyr::select(country_name, year, v2cademmob_osp, v2caautmob_osp) %>%
group_by(country_name) %>%
arrange(country_name, year) %>%
complete(., year = 1900:2020) %>%
ungroup() %>%
pivot_longer(cols = c("v2cademmob_osp", "v2caautmob_osp") ) %>%
mutate(country_name = str_replace_all(country_name, "/", "-")) #needed for loop
# Plot timelines for all countries
mylist <- list()
for (i in unique(data_long$country_name)) {
g <- ggplot(data = data_long %>% filter(country_name == i),
aes(x = year, y = value, group = name, color = name,
linetype = name)) +
geom_line(size = .8) +
geom_point(size = .5) +
scale_y_continuous("Mobilization", limits = c(0,4), breaks = c(0,1,2,3,4), labels = c(0,1,2,3,4)) +
scale_x_continuous("", limits = c(1900, 2021), breaks = seq(1900,2020,10), labels = seq(1900,2020,10)) +
scale_color_manual("",breaks = c("v2cademmob_osp", "v2caautmob_osp"),
values = c("#08519C", "#A50F15"),
labels = c("Pro-democracy", "Pro-autocracy")) +
scale_linetype_manual("",breaks = c("v2cademmob_osp", "v2caautmob_osp"),
values = c("solid", "dashed"),
labels = c("Pro-democracy", "Pro-autocracy")) +
theme(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
ggtitle(sprintf(i))
ggsave(paste0("Output/Appendix C/",i,".pdf"),
width = 7,
height = 5,
dpi = "retina")
mylist[[i]] <- ggplotGrob(g)
}
# save all plots in one file
ggsave(
filename = "Output/country_plots.pdf",
plot = marrangeGrob(mylist, nrow = 3, ncol = 2),
width = 210, height = 297, units = "mm"
)
##### ADDITIONAL ANALYSES #########----------------------------------------------
# Script to generate all other additional analyses including all robustness tests.
# Session info
# R version 4.1.0 (2021-05-18)
# Platform: x86_64-apple-darwin17.0 (64-bit)
# Running under: macOS Big Sur 11.6.8
#-------------------------------Preparation-------------------------------------
# Load data
load("Data/vdem_panel_final.Rda")
# prepare data e.g. log and lags
vdem_panel_final <- vdem_panel_final %>%
mutate(oil_gas_log = log(oil_gas_value_nom + 0.01),
v2x_polyarchy_lag = lag(v2x_polyarchy),
e_polity2_lag = lag(e_polity2)) %>%
arrange(country_name, year) %>%
group_by(country_name) %>%
mutate(across(c(v2x_polyarchy, v2cademmob, v2caautmob,
gdppc_log_lag, growth_rate_3yrs_lag, oil_gas_log,
pop_log_lag, e_peaveduc, ethnic_frac,
intrastate_conflict, v2x_ex_party,
v2x_ex_military, v2x_ex_hereditary), ~ .x - lag(.x),
.names = "{.col}_diff"),
year_fac = factor(year)) %>%
ungroup()
#-------------Polity as DV (Table B2)-------------------------------------------
# pooled model
mass.pooled.pol <- fixest::feols(e_polity2 ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(mass.pooled.pol)
# TW FEs
mass.fixed.pol <- fixest::feols(e_polity2 ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(mass.fixed.pol)
# LDV model
mass.LDV.pol <- fixest::feols(e_polity2 ~ e_polity2_lag + v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(mass.LDV.pol)
# FD model
mass.FD.pol <- plm::plm(e_polity2 ~ + v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag,
index = c("country_name", "year"),
model = "fd", data = vdem_panel_final)
# Export regression results to latex
texreg::htmlreg(file = "Output/table_B2.html", list(mass.pooled.pol, mass.fixed.pol,
mass.LDV.pol, mass.FD.pol),
booktabs = T,
omit.coef = "(Intercept)",
custom.coef.names = c("Mobilization for democracy",
"Mobilization for Autocracy",
"GDP per capita (log)",
"GDP growth rate",
"Gas and oil production (log)",
"Population (log)",
"Avg. years of education",
"Ethnic fractionalization",
"Intrastate conflict",
"Ruling party dimension",
"Military dimension",
"Hereditary dimension",
"Democracy (lag)"))
#-------------Extended controls (Table B3)--------------------------------------
# pooled model
mass.pooled_ext <- fixest::feols(v2x_polyarchy ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag +
election_year +
coup_attempt +
theta_mean,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(mass.pooled_ext)
# TW FEs
mass.fixed_ext <- fixest::feols(v2x_polyarchy ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag +
election_year +
coup_attempt +
theta_mean|
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(mass.fixed_ext)
# LDV model
mass.LDV_ext <- fixest::feols(v2x_polyarchy ~ v2x_polyarchy_lag + v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag+
election_year +
coup_attempt +
theta_mean |
country_name + year,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(mass.LDV_ext)
# FD model
mass.FD_ext <- plm::plm(v2x_polyarchy ~ + v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag +
election_year +
coup_attempt +
theta_mean,
index = c("country_name", "year"),
model = "fd", data = vdem_panel_final)
# Export regression results to latex
texreg::htmlreg(file = "Output/table_B3.html", list(mass.pooled_ext, mass.fixed_ext, mass.LDV_ext, mass.FD_ext),
booktabs = T,
omit.coef = "(Intercept)",
custom.coef.names = c("Mobilization for democracy",
"Mobilization for autocracy",
"GDP per capita (log)",
"GDP growth rate",
"Gas and oil production (log)",
"Population (log)",
"Avg. years of education",
"Ethnic fractionalization",
"Intrastate conflict",
"Ruling party dimension",
"Military dimension",
"Hereditary dimension",
"Elections",
"Coup attempt",
"Human rights protection",
"Democracy (lag)"))
#-------------EDI components (Table B4)--------------------------------------
# Freedom of Expression and Alternative Sources of Information
fixed_freeexp <- fixest::feols(v2x_freexp_altinf ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(fixed_freeexp)
# Freedom of Association
fixed_freeassoc <- fixest::feols(v2x_frassoc_thick ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(fixed_freeexp)
# Suffrage
fixed_suffr <- fixest::feols(v2x_suffr ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(fixed_suffr)
# free and fair elections
fixed_freefair <- fixest::feols(v2xel_frefair ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
#summary(fixed_freefair)
# elected officials index
fixed_elecoff <- fixest::feols(v2x_elecoff ~ v2cademmob_osp_lag + v2caautmob_osp_lag +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag |
country_name + year_fac,
data = vdem_panel_final,
panel.id = c("country_name", "year"),
vcov = "DK")
texreg::htmlreg(file = "Output/table_B4.html", list(fixed_elecoff, fixed_freeassoc, fixed_freeexp, fixed_freefair,
fixed_suffr), booktabs = T,
omit.coef = "(Intercept)",
custom.coef.names = c("Mobilization for democracy",
"Mobilization for Autocracy",
"GDP per capita (log)",
"GDP growth rate",
"Gas and oil production (log)",
"Population (log)",
"Avg. years of education",
"Ethnic fractionalization",
"Intrastate conflict",
"Ruling party dimension",
"Military dimension",
"Hereditary dimension"))
#-------------Additional lagged DVs (Table B5)----------------------------------
# FD model
mass.FD_lags <- plm::plm(v2x_polyarchy ~  v2cademmob_osp_lag + v2caautmob_osp_lag +
lag(v2cademmob_osp_lag,1) + lag(v2caautmob_osp_lag,1) +
lag(v2x_polyarchy, 1) +
lag(v2x_polyarchy, 2) +
lag(v2x_polyarchy, 3) +
gdppc_log_lag + growth_rate_3yrs_lag +
oil_gas_log + pop_log_lag +
e_peaveduc_lag +
ethnic_frac + intrastate_conflict +
v2x_ex_party_lag +  v2x_ex_military_lag +
v2x_ex_hereditary_lag,
index = c("country_name", "year"),
model = "fd", data = vdem_panel_final)
#summary(mass.FD_lags)
texreg::htmlreg(file = "Output/table_B5.html", coeftest(mass.FD_lags, vcov=vcovHC(mass.FD_lags,type="HC0")))
nobs(mass.FD)
AIC(mass.fd)
AIC(mass.FD)
BIC(mass.FD)
logLik(mass.FD)
